//
//  Netmanager.h
//  Net2
//
//  Created by student on 16/3/29.
//  Copyright © 2016年 NIIT. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Singleton.h"

@protocol NetManagerDelegate <NSObject>

-(void)loginSuccess;
-(void)loninFail:(NSError *)error;

// 电影列表获取回调
- (void)requestMovieListSuccess:(NSArray *)list;
- (void)requestMovieListFail:(NSError *)error;


@end

@interface Netmanager : NSObject

@property (nonatomic,weak) id<NetManagerDelegate> delegate;

SingletonH(Netmanager)

//1. 同步请求方式
//登陆 同步
+ (BOOL)loginWithName:(NSString *)userName
         WithPassword:(NSString *)password;
//列表页同步
+(NSArray *)requestMovieList;

//登陆 异步block
+(void)loginWithUserName:(NSString *)username
            WithPassword:(NSString *)password
        WithSuccessBlock:(void(^)())successBlock
         WithFailedBlock:(void(^)(NSError *))failBlock;

//登陆 异步代理
-(void)loginWithUserName:(NSString *)username
            WithPassword:(NSString *)password;

-(void)requestMovieList;
@end
